package Day02;

import jdk.swing.interop.SwingInterOpUtils;

public class Student {
    private String name;

    private int number;

    private Course course;

    public Student(String name, int number, Course course) {
        this.name = name;
        this.number = number;
        this.course = course;
    }

    public Student() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public Course getCourse() {
        return course;
    }

    public void setCourse(Course course) {
        this.course = course;
    }

    public void selection(Course course){
        this.course = course;

        System.out.println(this.getName() + "学生已经选课完毕啦" + "选课老师可还是"
                + this.getCourse().getTeacher());
    }

    public void cancle(){
        System.out.println(this.getName() + "学生已经退课完毕了，" + "所退选使得课程是"
                + this.getCourse().getTeacher());
        this.course = null;
    }


    public void display(){
        if(this.course == null){
            System.out.println(this.getName() + "已经退课或者还没有选课");
        }else{
            System.out.println(this.getName()+ "已经选课成功了， 课程名是"
                    +this.getCourse().getName()+ ",  上课老师是" + this.getCourse().getTeacher());
        }
    }
}
